<%--
  Created by IntelliJ IDEA.
  User: Alta Y
  Date: 2019/10/5
  Time: 19:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>公告审核</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <link rel="stylesheet" href="css/admin.css">
    <script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
</head>

<body>
<div class="layui-col-md12">
<form method="post" id="audit" class="layui-form">
    <input type="hidden" name="audit_user" value="${user.username}">
    <input type="hidden" name="notify_id" value="${info.notify_id}">
    <div class="layui-card">
        <p class="ann_title">${info.title}</p>
        <p class="ann_time"><fmt:formatDate value="${info.create_date}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate> </p>
        <p class="ann_content">${info.content}</p>

        <div class="btndiv">
            <button class="layui-btn" lay-filter="pass" lay-submit="">通过</button>
            <button class="layui-btn layui-btn-primary" lay-filter="reject" lay-submit="">驳回</button>
        </div>

    </div>
</form>
</div>

<script>

    layui.use(['form', 'layer', 'jquery'],
        function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;

            //监听提交
            form.on('submit(pass)',
                function (data) {
                    $.ajax({
                        type:"post",
                        data:$('#audit').serialize(),
                        url:"/pass",
                        success:function (data) {
                            layer.msg('审核通过', {
                                icon: 1,
                                time: 1000 //1秒关闭（如果不配置，默认是3秒）
                            }, function(){
                                setTimeout(function(){parent.window.location.reload();},1500);
                            });
                        }
                    });
                    return false;
                });


            form.on('submit(reject)',
                function (data) {
                    $.ajax({
                        type:"post",
                        data:$('#audit').serialize(),
                        url:"/reject",
                        success:function (data) {
                            layer.msg('已驳回', {
                                icon: 1,
                                time: 1000 //1秒关闭（如果不配置，默认是3秒）
                            }, function(){
                                setTimeout(function(){parent.window.location.reload();},1500);
                            });
                        }
                    });
                    return false;
                });
        });
</script>

</body>

</html>
